<?php
namespace Plugin\Attractions\Inspection\Schema\Inspection_devices;

use Plugin\Attractions\Inspection\Model\Inspection_devices\InspectionDevices;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 设备
 */
#[Schema(title: 'InspectionDevicesSchema')]
class InspectionDevicesSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'name', title: '设备名称', type: 'varchar')]
    public string $name;

    #[Property(property: 'model', title: '设备型号', type: 'varchar')]
    public string $model;

    #[Property(property: 'longitude', title: '经度', type: 'double')]
    public string $longitude;

    #[Property(property: 'latitude', title: '纬度', type: 'double')]
    public string $latitude;

    #[Property(property: 'altitude', title: '海拔高度', type: 'double')]
    public string $altitude;

    #[Property(property: 'type_id', title: '设备类型ID', type: 'bigint')]
    public string $type_id;

    #[Property(property: 'status', title: '当前状态 1在线 2离线', type: 'tinyint')]
    public string $status;

    #[Property(property: 'vendor_id', title: '供应商ID', type: 'bigint')]
    public string $vendor_id;

    #[Property(property: 'service_id', title: '服务商ID', type: 'bigint')]
    public string $service_id;

    #[Property(property: 'device', title: '关联设备', type: 'varchar')]
    public string $device;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;




    public function __construct(InspectionDevices $model)
    {
       $this->id = $model->id;
       $this->name = $model->name;
       $this->model = $model->model;
       $this->longitude = $model->longitude;
       $this->latitude = $model->latitude;
       $this->altitude = $model->altitude;
       $this->type_id = $model->type_id;
       $this->status = $model->status;
       $this->vendor_id = $model->vendor_id;
       $this->service_id = $model->service_id;
       $this->device = $model->device;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'name' => $this->name ,'model' => $this->model ,'longitude' => $this->longitude ,'latitude' => $this->latitude ,'altitude' => $this->altitude ,'type_id' => $this->type_id ,'status' => $this->status ,'vendor_id' => $this->vendor_id ,'service_id' => $this->service_id ,'device' => $this->device ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}